/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.com.wholeconsulting.pacc.gui.modelos.calculos;

import ar.com.wholeconsulting.pacc.model.Envolvente;
import ar.com.wholeconsulting.pacc.model.cabezal.CabezalConico;
import ar.com.wholeconsulting.pacc.model.cabezal.CabezalSemiEsferico;
import ar.com.wholeconsulting.pacc.model.cabezal.CabezalSemieliptico;
import ar.com.wholeconsulting.pacc.model.cabezal.CabezalTapaPlana;
import ar.com.wholeconsulting.pacc.model.cabezal.CabezalTorisferico;

/**
 *
 * @author pable
 */
public enum ElementosGui {

    ENVOLVENTE(FrameCalculoEnvolvente.class,Envolvente.class),
    CABEZAL_CONICO(FrameCalculoEnvolvente.class,CabezalConico.class),
    CABEZAL_TORISFERICO(FrameCalculoTorisferico.class,CabezalTorisferico.class),
    CABEZAL_SEMIESFERICO(FrameCalculoEnvolvente.class,CabezalSemiEsferico.class),
    CABEZAL_SEMIELIPTICO(FrameCalculoEnvolvente.class,CabezalSemieliptico.class),
    TAPA_PLANA(FrameCalculoEnvolvente.class,CabezalTapaPlana.class);
    private Class clazzFrame;
    private Class clazzElemento;

    private ElementosGui(Class clazzFrame, Class clazzCabezal) {
        this.clazzFrame = clazzFrame;
        this.clazzElemento = clazzCabezal;
    }

    public Class getFrame() {
        return clazzFrame;
    }

    static public Class fromClass(Class clazz) throws NoSuchFieldException{
        for(ElementosGui elemento : values()){
            if(clazz.equals(elemento.clazzElemento)){
                return elemento.clazzFrame;
            }
        }
        throw new NoSuchFieldException();
    }

    @Override
    public String toString() {
        return super.toString().replaceAll("_"," ");
    }


}
